package com.zsh.weather.ln.base

import android.os.Bundle

abstract class BaseMVPActivity<in V : IView, P : IPresenter<in V>> : BaseActivity(), IView {
    protected lateinit var presenter: P
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        presenter = createPresenter()
        presenter.attachView(this as V)
    }

    /*
    * presenter
    * */
    abstract fun createPresenter(): P

    override fun onDestroy() {
        super.onDestroy()
        if(presenter != null){
            presenter.detachView()
        }
    }
}